package model

import (
	"gitee.com/xuxinzhi2206/corehub/database/mysql"
	"gorm.io/gorm"
)

type Good struct {
	gorm.Model
	GoodId    int64  `gorm:"type:int(11);comment:商品id"`
	GoodName  string `gorm:"type:varchar(255);comment:商品名称"`
	GoodPrice string `gorm:"type:varchar(255);comment:商品价格"`
	GoodNum   int64  `gorm:"type:int(11);comment:商品数量"`
}

func (g *Good) CreateGood() (err error) {
	return mysql.WithMysql(func(db *gorm.DB) error {
		return db.Create(g).Error
	})
}
